package com.itheima.controller;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

// 被扫描
// 返回json
// AOP 切面
@RestControllerAdvice

public class ExceptionAdviceHandler {

    // 路径   拦截的异常
    // 方法

    @ExceptionHandler(Exception.class)
    public Result exception(Exception e) {

        System.out.println(e.getMessage());
        return new Result(Code.ERR_ERR, "8BQ了~网络出问题了", null);
    }

}
